/**
 * 
 */
var map;
function initialize() {
	var myOptions = {
		zoom : 4,
		center : new google.maps.LatLng(-25.363882, 131.044922),
		mapTypeId : google.maps.MapTypeId.ROADMAP
	};

	map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

	var marker = new google.maps.Marker({
		position : map.getCenter(),
		map : map,
		title : 'Click to zoom'
	});

	google.maps.event.addListener(marker, 'click', function() {
		if (map.getZoom() == 8) {
			map.setZoom(4);
		} else {
			map.setZoom(8);
		}
	});
	test();
}

function test() {
	Ext.Ajax.request({
		url : 'markerAction',
		method : 'post',
		params : {},
		success : function(response, action) {
			alert("aaaa");
			var rs = eval(response.responseText);
			for ( var i = 0; i < rs.length; i++) {
				new google.maps.Marker({
					position : new google.maps.LatLng(rs[i].lat, rs[i].lng),
					map : map,
					title : 'Click to zoom'
				});
				// alert(rs[i].lat);
			}
		},
		failure : function(response, action) {
			var rs = response.responseText;
			alert(rs);
		}
	});
}

google.maps.event.addDomListener(window, 'load', initialize);